package lesson.Client;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class Talk2 {
    public static void main(String[] args) throws IOException {
        //快递点
        DatagramSocket datagramSocket = new DatagramSocket();
        Scanner sc= new Scanner(System.in);

        //打包礼物
        while (true) {
            String s = sc.next();
            if(s.equals("886")){
                break;
            }
            byte[] b = s.getBytes();
            //发给谁
            InetAddress address = InetAddress.getByName("127.0.0.1");
            //给哪个程序发
            //包装东西
            DatagramPacket dp = new DatagramPacket(b,b.length,address,10000);

            //由快递点发送包裹
            datagramSocket.send(dp);
        }
        //付钱走人
        datagramSocket.close();

    }
}
